#ifndef __SSD_SIMULATION__
#define __SSD_SIMULATION__

#include <cstring>
#include <cstdio>
#include <assert.h>
#include <set>
#include <iostream>

using namespace std;


#define DISK_SIZE 67108864 //sector 512B, 32GB capacity. so size is 32 * 1024 * 1024 * 2
#define CACHE_SIZE 65536 //cache is 256MB, 4KB of a page
//////////////////////////////
//define operation TYPE
#define WRITE 0
#define READ 1
/////////////////////////////
//define event type
#define SIMULATION_STOP 0
#define IO_SEVERCE_REQUEST 1
#define IO_COMPLETION 2
#define IO_CACHE_REQUEST 3
/////////////////////////////
//define event flag, victim_request should not be added to accumulative delay
#define REAL_IO_REQUEST 1
#define VICTIM_IO_REQUEST 2
/////////////////////////////
#define TRUE 1
#define FALSE 0

class ioreq_event{
public:
	ioreq_event(){
			next = prev = NULL;
	}
	double time;
	int devno;
	int blkno;
	int bcount;
	int operation;
	int type;
	int stop;
	int flag; //whether the delay should be accumulated;
	ioreq_event *next;
	ioreq_event *prev;
};

#define __DEBUG__

#ifdef __DEBUG__
	#define DEBUG(format, ...) \
		do { \
			fprintf(stderr, "[%s@%s,%d] " format "\n", \
				 __func__, __FILE__, __LINE__, ##__VA_ARGS__ ); \
		} while (0);
#else
	#define DEBUG(...) do{}while(0);
#endif

#endif
